<?php
/**
 * Created by PhpStorm.
 * User: QK
 * Date: 2018-07-25
 * Time: 上午 10:21
 */
namespace app\blog\controller;
use cmf\controller\AdminBaseController;
use app\blog\model\CountModel as co;
class CountController extends AdminBaseController{
    /**
     * 商品列表页面
    */
    public function _initialize()
    {
        parent::_initialize();
        $this->co =new co();
    }

    public function indexs(){

    }
    public function index(){
        $array=$this->request->param();
        $cause='';
        if(isset($array['pay_type']))
        {
          if($array['pay_type']>0)
          {
              $cause['id']=$array['pay_type'];
          }
        }
        if(isset($array['refunt']))
        {
            if($array['refunt']!=0)
            {
                $refunt=$array['refunt'];
            }else{
                $refunt=0;
            }
        }else{

            $refunt=0;
        }
        if(isset($array['pay_status']))
        {
            if($array['pay_status']!=0)
            {
                $pay_status=$array['pay_status'];
            }else{
                $pay_status=0;
            }
        }else{
            $pay_status=0;
        }
        /*商品总计*/
        $total=$this->co->total($array);
        $pay=$this->co->pay($cause,$state=1);
        $data=$this->co->index($array);
        $this->assign('pay_status',$pay_status);
        $this->assign('refunt',$refunt);
        $this->assign('data',$data['data']);
        $this->assign('total',$total[0]);
        $this->assign('pay',$pay);
        $this->assign('page',$data['page']);
        return $this->fetch('count/index');
    }
    /**
     * 商品详情页面
    */
    public function details(){
        $date=$this->request->param();
        $data=$this->co->details($date);
        $this->assign('data',$data['data']);
        $this->assign('page',$data['page']);
        return $this->fetch('count/details');
    }
}